/**
 * 谷歌图层管理
 */
import L from "leaflet";
export const googleTiledMap = {
  tiledLayer(type, options) {
    if (options == null) {
      options = { subdomains: ["0", "1", "2", "3"] };
    } else {
      options["subdomains"] = ["0", "1", "2", "3"];
    }

    if (type === "img") {
      return L.tileLayer(
        "http://mt{s}.google.cn/vt/lyrs=y&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}",
        { subdomains: ["0", "1", "2", "3"] }
      );
    } else if (type === "vec") {
      return L.tileLayer(
        "http://mt{s}.google.cn/vt/lyrs=m&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}",
        options
      );
    } else if (type === "ter") {
      return L.tileLayer(
        "http://mt{s}.google.cn/vt/lyrs=p&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}",
        { subdomains: ["0", "1", "2", "3"] }
      );
    } else {
      return null;
    }
  }
};
